package com.dmpp.mes.controller;


import com.dmpp.mes.bean.ResponseData;
import com.dmpp.mes.parameterInfo.Aroma;
import com.dmpp.mes.parameterInfo.Bom;
import com.dmpp.mes.service.AromaService;
import com.dmpp.mes.service.BomService;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
@RequestMapping("Bom")
public class BomController {
//Bom
    @Autowired
    private BomService service;


    @RequestMapping(value = "/FindAll", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData findAll(Integer page, Integer pageSize,Bom bom) {
        PageHelper.startPage(page, pageSize);
        return service.findAll(bom);
    }

    @RequestMapping(value = "/FindByProductNo", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData findByProductNo(Bom bom) {
        return service.findByMaterielNo(bom);
    }

    @RequestMapping(value = "/Insert", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData insert(Bom bom) {
        return service.insert(bom);
    }

    @RequestMapping(value = "/UpdateByCode", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData updateByCode(Bom bom) {
        return service.updateByCode(bom);
    }

    @RequestMapping(value = "/Delete", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData delete(Bom bom) {
        return service.delete(bom);
    }


}
